﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.Core.Modelling.Primitives;

namespace ITAP.ShprossesBuilder.Modelling.Components.Constraints
{
    [Serializable]
    public class ConnectedShprossesEndToEndCutAngleConstraint : IConstraint
    {

        #region IConstraint Members

        public bool Check(IComponent component)
        {
            return false;
        }

        public void Fix(IComponent component)
        {
            if (!(component is Shpross))
                return;

            //Shpross shpross = component as Shpross;
            //foreach (IComponent connectedComponent in component.ConnectedComponents)
            //{
            //    if (connectedComponent is Shpross)
            //    {
            //        Shpross connectedShpross = connectedComponent as Shpross;

            //        IWidePrimitive shprossPrimitive = shpross.Primitives[0] as IWidePrimitive;
            //        IWidePrimitive connectedShprossPritmitive = connectedShpross.Primitives[0] as IWidePrimitive;

            //        if (shpross.IsConnectedToEnd(connectedShpross) == EndType.Start)
            //        {
            //            if (connectedShpross.IsConnectedToEnd(shpross) == EndType.Start)
            //            {                            
            //                shprossPrimitive.DownBorder.IntersectMainLines(connectedShprossPritmitive.DownBorder
            //            }

            //            else if (connectedShpross.IsConnectedToEnd(shpross) == EndType.End)
            //                connectedShpross.MoveEndPointTo(shpross.StartPoint);
            //            else
            //                continue;
            //        }
            //        else if (shpross.IsConnectedToEnd(connectedShpross) == EndType.End)
            //        {
            //            if (connectedShpross.IsConnectedToEnd(shpross) == EndType.Start)
            //                connectedShpross.MoveStartPointTo(shpross.EndPoint);

            //            else if (connectedShpross.IsConnectedToEnd(shpross) == EndType.End)
            //                connectedShpross.MoveEndPointTo(shpross.EndPoint);
            //            else
            //                continue;
            //        }
            //        else
            //            continue;
            //    }
            //}

        }

        public bool Enabled
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public ConstraintAction Action
        {
            get { throw new NotImplementedException(); }
        }

        #endregion

        #region ICloneable Members

        public object Clone()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
